/**
 * 
 */
package com.java.test.audit.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.json.JSONObject;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDateTime;
import java.time.ZoneOffset;

/**
 * @author 存款审核
 *
 */
public class DepositExamineInfo implements RowMapper<DepositExamineInfo> {

	// 主键id
	private int id;

	// 游戏账号
	private String gameAccount;

	// 收款账户
	private String makecollections;

	// 所属分层id
	private int sliceValue;

	// 分层名称
	private String sliceName;

	// 存款金额
	private double depositAmount;
	
	// 优惠金额
	private double discountAmount; 
	
	

	// 存款时间
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime depositTime;

	// 存款方式 -- 收款账户
	private int depositChannelValue;

	// --收款
	private String depositChannelName;

	// 存款人姓名
	private String outbankPeopleName;

	// 存款账号
	private String outbankAccount;

	// 入款账号
	private String incomeAccount;

	// (0:未审核,1:审核通过，2：审核不通过) -- 审核状态 -- 默认未审核
	private int status = 0;

	// 订单编号
	private String orderNumber;

	// 订单生成时间
	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	private LocalDateTime orderCreateTime;

	// 备注
	private String content;

	// 存款类型 ： 用来区分游戏端 以什么样的方式进行存款
	private int depositType;

	private String gameUniqueId;
	
	
	public String getGameUniqueId() {
		return gameUniqueId;
	}

	public void setGameUniqueId(String gameUniqueId) {
		this.gameUniqueId = gameUniqueId;
	}

	public double getDiscountAmount() {
		return discountAmount;
	}

	public void setDiscountAmount(double discountAmount) {
		this.discountAmount = discountAmount;
	}

	public String getOutbankPeopleName() {
		return outbankPeopleName;
	}

	public void setOutbankPeopleName(String outbankPeopleName) {
		this.outbankPeopleName = outbankPeopleName;
	}

	public int getDepositType() {
		return depositType;
	}

	public void setDepositType(int depositType) {
		this.depositType = depositType;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getGameAccount() {
		return gameAccount;
	}

	public void setGameAccount(String gameAcount) {
		this.gameAccount = gameAcount;
	}

	public int getSliceValue() {
		return sliceValue;
	}

	public void setSliceValue(int sliceValue) {
		this.sliceValue = sliceValue;
	}

	public String getSliceName() {
		return sliceName;
	}

	public void setSliceName(String sliceName) {
		this.sliceName = sliceName;
	}

	public double getDepositAmount() {
		return depositAmount;
	}

	public void setDepositAmount(double depositAmount) {
		this.depositAmount = depositAmount;
	}

	public LocalDateTime getDepositTime() {
		return depositTime;
	}

	public void setDepositTime(LocalDateTime depositTime) {
		this.depositTime = depositTime;
	}

	public int getDepositChannelValue() {
		return depositChannelValue;
	}

	public void setDepositChannelValue(int depositChannelValue) {
		this.depositChannelValue = depositChannelValue;
	}

	public String getDepositChannelName() {
		return depositChannelName;
	}

	public void setDepositChannelName(String depositChannelName) {
		this.depositChannelName = depositChannelName;
	}

	public String getOutbankAccount() {
		return outbankAccount;
	}

	public void setOutbankAccount(String outbankAccount) {
		this.outbankAccount = outbankAccount;
	}

	public String getIncomeAccount() {
		return incomeAccount;
	}

	public void setIncomeAccount(String incomeAccount) {
		this.incomeAccount = incomeAccount;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getOrderNumber() {
		return orderNumber;
	}

	public void setOrderNumber(String orderNumber) {
		this.orderNumber = orderNumber;
	}

	public LocalDateTime getOrderCreateTime() {
		return orderCreateTime;
	}

	public void setOrderCreateTime(LocalDateTime orderCreateTime) {
		this.orderCreateTime = orderCreateTime;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getMakecollections() {
		return makecollections;
	}

	public void setMakecollections(String makecollections) {
		this.makecollections = makecollections;
	}

	@Override
	public DepositExamineInfo mapRow(ResultSet rs, int rowNum) throws SQLException {
		DepositExamineInfo info = new DepositExamineInfo();
		info.setId(rs.getInt("id"));
		info.setDepositAmount(rs.getDouble("deposit_amount"));
		info.setDepositChannelValue(rs.getInt("deposit_channelvalue"));
		info.setDepositChannelName(rs.getString("deposit_channelname"));
		info.setDepositTime(rs.getTimestamp("deposit_time") == null ? null
				: rs.getTimestamp("deposit_time").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());

		info.setGameAccount((rs.getString("game_account")));
		info.setIncomeAccount(rs.getString("income_account"));
		info.setOutbankAccount(rs.getString("out_bankaccount"));
		info.setSliceName(rs.getString("slice_name"));
		info.setSliceValue(rs.getInt("slice_value"));
		info.setStatus(rs.getInt("status"));
		info.setOrderNumber(rs.getString("order_number"));
		info.setOrderCreateTime(rs.getTimestamp("order_create_time") == null ? null
				: rs.getTimestamp("order_create_time").toInstant().atZone(ZoneOffset.ofHours(8)).toLocalDateTime());
		info.setContent(rs.getString("content"));
		info.setDepositType(rs.getInt("deposit_type"));
		info.setMakecollections(rs.getString("make_collections"));
		info.setOutbankPeopleName(rs.getString("outbank_peoplename"));
		info.setDiscountAmount(rs.getDouble("discount_amount"));
		info.setGameUniqueId(rs.getString("game_unique_id"));
		
		return info;
	}

	public JSONObject toString_my() {
		JSONObject str = new JSONObject();
		str.put("content",this.getContent());
		str.put("depositAmount",this.getDepositAmount());
		str.put("depositChannelName",this.getDepositChannelName());
		str.put("depositChannelValue",this.getDepositChannelValue());
		str.put("depositTime",this.getDepositTime());
		str.put("depositType",this.getDepositType());
		str.put("gameAccount",this.getGameAccount());
		str.put("id",this.getId());
		str.put("incomeAccount",this.getIncomeAccount());
		str.put("makecollections",this.getMakecollections());
		str.put("orderCreateTime",this.getOrderCreateTime());
		str.put("orderNumber",this.getOrderNumber());
		str.put("outbankAccount",this.getOutbankAccount());
		str.put("outbankPeopleName",this.getOutbankPeopleName());
		str.put("sliceName",this.getSliceName());
		str.put("sliceValue",this.getSliceValue());
		str.put("status",this.getStatus());
		return str;
	}
}
